<?php
include "connect.php";
$fileName = $_FILES['picture']['name']; 
$fileSize = $_FILES['picture']['size']; 
$fileError = $_FILES['picture']['error']; 
if($fileSize > 0 || $fileError == 0){ 
$move = move_uploaded_file($_FILES['picture']['tmp_name'], 'C:\xampp\htdocs\kodingangarboyo\gambar'.$fileName); 
if($move){
echo "<h3>SUKSES </h3>";
$q = "INSERT into image VALUES('','$fileName','image/$fileName')";
$result = mysql_query($q);

$q1 = "SELECT location from image where filename = '$fileName' limit 1 "; 
$result = mysql_query($q1);
while ($data = mysql_fetch_array($result)) {
$loc = $data['location']; ?>
<br/>
<h2> File Images Anda </h2>
<img src="C:\xampp\htdocs\kodingangarboyo\gambar"<?php echo $loc; ?>" /> 
<div>
<a href="galeri.php">Kembali</a>
</div>
<?php
}
} else{
echo "<h3>Failed! </h3>";
}
} else {
echo "Failed to Upload : ".$fileError;
}
?>
